
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="renderer" content="webkit" />
<title>主页</title>

<link rel="stylesheet" type="text/css" href="../../../plugins/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="../../../plugins/jquery-easyui/1.8.6/themes/bootstrap/easyui.css" />
<link rel="stylesheet" type="text/css" href="../../../plugins/jquery-easyui/1.8.6/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../../../plugins/bootstrap/3.3.7/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="../../../plugins/font-awesome/css/font-awesome.min.css" />
    
    
<link rel="stylesheet" type="text/css" href="../../../css/zbootstrap.css" />
<link rel="stylesheet" type="text/css" href="../../../css/zeasyui.css" />
<link rel="stylesheet" type="text/css" href="../../../css/common.css" />
    
<script type="text/javascript" src="../../../plugins/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="../../../plugins/jquery-rstorage/1.3.2/jquery.rStorage.min.js"></script>
<script type="text/javascript" src="../../../plugins/jquery-easyui/1.8.6/jquery.easyui.min.js"></script>
    
<script type="text/javascript" src="../../../js/zGlobal.js"></script>
<script type="text/javascript" src="../../../js/zApi.js"></script>
<script type="text/javascript" src="../../../js/zUtil.js"></script>
<script type="text/javascript" src="../../../js/zAlert.js"></script>
<script type="text/javascript" src="../../../js/zDict.js"></script>
<script type="text/javascript" src="../../../js/zTable.js"></script>
<script type="text/javascript" src="../../../js/zDialog.js"></script>
<script type="text/javascript" src="../../../js/zForm.js"></script>
    
    <![if IE]>

    <![endif]>

</head>
<body onload="noright(document.body);">

    <div id="p-all" class="easyui-layout" data-options="fit:true,border:false," style="border: 0px solid #D8D9E5;"> 
     <div data-options="region:'center',split:false,border:false,minWidth:200" style="overflow: hidden;width:50%;border-right:1px solid rgb(210, 208, 208);"> 
       <div style="height: 36px;padding:5px 3px;position: absolute;z-index: 2;right: 2px;">
        <input id="table-toggle" class="easyui-switchbutton" style="" />
       </div> 
      <table id="table-left"></table> 
     </div> 
     <div data-options="region:'east',split:true,border:false,minWidth:200" style="overflow: hidden;width:50%;border-left:1px solid rgb(210, 208, 208);"> 
      <table id="table-right"></table> 
     </div> 
    </div> 

  <!---分割-------------------------------------------------------------------------------->
  <div id="dlg-add-left" style="display:none;"> 
   <div class="main-content"> 
    <form>
    <div class="row">&nbsp;</div> 
     <div class="row padding-right"> 
     <div class="col-sm-12"> 
          <div class="row" style="padding: 3px;"> 
           <fieldset style="border: 1px solid #e5e5e5;padding-bottom: 5px;"> 
              <legend class=" text-info">说明</legend>
              <span class="description-text">解析表结构时，转换数据库字段类型为java类型</span>
           </fieldset>
          </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="mappingTitle" name="mappingTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">数据库类型</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="databaseType" name="databaseType" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">匹配模式</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="matchWay" name="matchWay" data-options="required:true,panelHeight:70" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form> 
   </div> 
  </div>


  <div id="dlg-edit-left" style="display:none;"> 
   <div class="main-content"> 
    <form>
    <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <input id="mappingId" name="mappingId" type="hidden" />
     
     <div class="col-sm-6"> 
      <label class="form-lable">标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="mappingTitle" name="mappingTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">数据库类型</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="databaseType" name="databaseType" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">匹配模式</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="matchWay" name="matchWay" data-options="required:true,panelHeight:70" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">状态</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="dataStatus" name="dataStatus" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建用户ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createOprid" name="createOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建用户</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createName" name="createName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createTm" name="createTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新用户ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdOprid" name="lastUpdOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新用户</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdName" name="lastUpdName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdTm" name="lastUpdTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form> 
   </div> 
  </div>

  <div id="dlg-query-left" style="display:none;">
    <div class="main-content">
    <form>
     <div class="row padding-right">
     </div> 
     <div class="row padding-right">
     <div class="col-sm-12"> 
      <label class="form-lable">标题</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="mappingTitle" name="mappingTitle" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">数据库类型</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="databaseType" name="databaseType" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">匹配模式</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="matchWay" name="matchWay" data-options="panelHeight:70" style="width:100%;" ></select>
      </div> 
     </div> 
     </div> 
    </form>
    </div>
  </div>
  <!---分割-------------------------------------------------------------------------------->
  <div id="dlg-add-right" style="display:none;">
    <div class="main-content"> 
    <form>
    <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <div class="col-sm-12"> 
          <div class="row" style="padding: 3px;"> 
           <fieldset style="border: 1px solid #e5e5e5;padding-bottom: 5px;"> 
              <legend class="wtext-info">说明</legend>
              <span class="description-text">1、java默认全都处理为String,当然String类型可能不利于后续转换；2、建议申明特殊类型：如Date,Instant,BigDecimal等</span>
           </fieldset>
          </div>
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">映射关系</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="mappingId" name="mappingId" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">匹配规则</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="matchingRule" name="matchingRule" data-options="required:true,prompt:'例：字符:cha ;正则:^var'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JDBC类型</label> 
      <div class="input-block"> 
        <select class="easyui-textbox" id="jdbcType" name="jdbcType" data-options="required:true,prompt:'例：varchar。xml中不用就随便写'" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">是否标准类型</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="standardFlag" name="standardFlag" data-options="required:true,panelHeight:70,prompt:'例如：String是，BigDecimal不是。不用就随便选'" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JAVA类型</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="javaType" name="javaType" data-options="prompt:'例：BigDecimal'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JAVA类型(全)</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="javaFullType" name="javaFullType" data-options="prompt:'例：java.math.BigDecimal'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JAVA扩展类型</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="javaVoType" name="javaVoType" data-options="prompt:'例：String。BigDecimal用String接收'" style="width:100%;" /> 
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form> 
   </div> 
  </div>
  
  <div id="dlg-edit-right" style="display:none;">
    <div class="main-content"> 
    <form>
    <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <input id="mappingDtlId" name="mappingDtlId" type="hidden" /><!-- 映射明细主键ID -->
     <div class="col-sm-6"> 
      <label class="form-lable">映射关系</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="mappingId" name="mappingId" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">匹配规则</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="matchingRule" name="matchingRule" data-options="required:true,prompt:'例：字符:cha ;正则:^var'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JDBC类型</label> 
      <div class="input-block"> 
        <select class="easyui-textbox" id="jdbcType" name="jdbcType" data-options="required:true,prompt:'例：varchar。xml中不用就随便写'" style="width:100%;" ></select> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">是否标准类型</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="standardFlag" name="standardFlag" data-options="required:true,panelHeight:70,prompt:'例如：String是，BigDecimal不是。不用就随便选'" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JAVA类型</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="javaType" name="javaType" data-options="prompt:'例：BigDecimal'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JAVA类型(全)</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="javaFullType" name="javaFullType" data-options="prompt:'例：java.math.BigDecimal'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JAVA扩展类型</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="javaVoType" name="javaVoType" data-options="prompt:'例：String。BigDecimal用String接收'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">状态</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="dataStatus" name="dataStatus" data-options="multiple:false" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建用户ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createOprid" name="createOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建用户</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createName" name="createName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createTm" name="createTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新用户ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdOprid" name="lastUpdOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新用户</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdName" name="lastUpdName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdTm" name="lastUpdTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form> 
   </div> 
  </div>
  
  <div id="dlg-query-right" style="display:none;">
   <div class="main-content">
    <form>
     <div class="row padding-right">
     <div class="col-sm-12"> 
      <label class="form-lable">映射关系</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="mappingId" name="mappingId" data-options="" style="width:100%;" ></select> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">匹配规则</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="matchingRule" name="matchingRule" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">JDBC类型</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="jdbcType" name="jdbcType" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">是否标准类型</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="standardFlag" name="standardFlag" data-options="panelHeight:70" style="width:100%;" ></select> 
      </div> 
     </div> 
     </div> 
    </form>
   </div>
  </div>

   <!--  字段映射规则选择 -->
  <div id="dlg-select-jdbcType" style="display:none;overflow: hidden;">
       <div  style="height: 100%;" > 
        <div id="table-jdbcType-toolbar" style="padding:5px;height:auto">
            <div><span style="color: red;">fieldMapping.fieldTypeList配置了一些常用的。没有可用的则直接填写</span></div>
        </div>
        <table id="table-jdbcType"></table> 
       </div> 
  </div>

 <script>
  TableToggleFlag = true;//默认开启联动
  TableSelectFlag = null;//默认未选中
  DictNames = {};
  
  /* --分割------------------------------------------------------------------------------ */
  
  TitleLeft = "字段映射";
  IdDlgAddLeft = "#dlg-add-left";
  IdDlgEditLeft = "#dlg-edit-left";
  IdDlgQueryLeft = "#dlg-query-left";
  IdTableLeft = "#table-left";
  TableHeaderLeftMenu = null;
  
  /* --分割------------------------------------------------------------------------------ */
  
  TitleRight = "字段映射明细";
  IdDlgAddRight = "#dlg-add-right";
  IdDlgEditRight = "#dlg-edit-right";
  IdDlgQueryRight = "#dlg-query-right";
  IdTableRight = "#table-right";
  TableHeaderRightMenu = null;
  
  /* --分割------------------------------------------------------------------------------ */
  $(function(){
    loadDictToPage();//字典
    $('#table-toggle').switchbutton({
      checked:true,
      handleText:'明细',
      width:75,
      height:25,
      handleWidth:35,
      onChange:function(checked){
        if(checked){
          TableToggleFlag = true;
          $('#p-all').layout('expand','east');
        }else{
          TableToggleFlag = false;
          $('#p-all').layout('collapse','east');
        }
        $('#p-all .layout-expand.layout-expand-east').addClass('disabled');
      }
    });
    
    /* --分割------------------------------------------------------------------------------ */
    
    var urlLeft = zGlobal["http"] + "/autocode/fieldMapping/list";
    var buttonsIdxLeft = [0,4];
    var buttonsFuncLeft = [dlgAddLeft,dlgQueryLeft];
    var optionsLeft = {
            queryParams:{},
            url : urlLeft,
            idField: 'mappingId',
            sortName: 'createTm',
            sortOrder: 'desc',
            multiSort: true,
            columns:[[
                {field: 'mappingId', title: '映射主键ID', align: 'center', width: 100, hidden: true},
                {field: 'databaseType', title: '数据库类型', align: 'center', width: 100, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"dict.databaseType")}},
                {field: 'matchWay', title: '匹配模式', align: 'center', width: 100, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"fieldMapping.matchWay")}},
                {field: 'orderNum', title: '排序', align: 'center', width: 100},
                {field: 'dataStatus', title: '状态', align: 'center', width: 100, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"dict.dataStatus")}},
                {field: 'createName', title: '创建用户', align: 'center', width: 100},
                {field: 'createTm', title: '创建时间', align: 'center', width: 135,sortable: true},
                {field: ' ', title: ' ', align: 'center', width: 100},
            ]],
            frozenColumns:[[
//              {field:'', title:'', align:'center', checkbox:true},
             {field:'buttonArr', title:'操作', align:'center', width: 60, formatter:buttonsFormatterLeft},
             {field: 'mappingTitle', title: '标题', align: 'center', width: 100},
            ]],
            onDblClickCell: function(rowIndex, field, value){
                if("buttonArr" != field){
                    dlgDtlLeft(rowIndex);
                }
            },
            onSelect: function(rowIndex, rowData){
              if(TableToggleFlag && rowData['mappingId'] != TableSelectFlag){
                TableSelectFlag = rowData['mappingId'];
                zUtil.formClear(IdDlgQueryRight + ' form');
                zUtil.val(IdDlgQueryRight + ' #mappingId',rowData['mappingId']);
                zUtil.readonly(IdDlgQueryRight + ' #mappingId');
                zUtil.tableQuery(IdTableRight,{
                  'mappingId': rowData['mappingId']
                },{url:urlRight});
              }
            },
            onHeaderContextMenu: function(e, field){
              TableHeaderLeftMenu = zUtil.tableHeaderMenu(e,TableHeaderLeftMenu,IdTableLeft);
            },
            onRowContextMenu: function(e, rowIndex, rowData){
              e.preventDefault();
              zUtil.tableSelected(IdTableLeft,rowIndex);
              if(rowData != null){
                  dlgEditLeft(rowData);
              }
            },
    };
    zUtil.tableInit(IdTableLeft,optionsLeft,buttonsIdxLeft,buttonsFuncLeft);
    
    
    /* --分割------------------------------------------------------------------------------ */
    var urlRight = zGlobal["http"] + "/autocode/fieldMappingDtl/list";
    var buttonsIdxRight = [0,4];
    var buttonsFuncRight = [dlgAddRight,dlgQueryRight];
    var optionsRight = {
            queryParams:{},
            url : '',
            idField: 'mappingDtlId',
            sortName: 'createTm',
            sortOrder: 'desc',
            multiSort: true,
            columns:[[
                {field: 'mappingDtlId', title: '映射明细主键ID', align: 'center', width: 100, hidden: true},
                {field: 'mappingId', title: '映射主键ID', align: 'center', width: 100, hidden: true},
                {field: 'jdbcType', title: 'JDBC类型', align: 'center', width: 100},
                {field: 'standardFlag', title: '是否标准类型', align: 'center', width: 100, formatter: function(value,rowData,rowIndex){return zUtil.dictConvertOfAutocode(value,"dict.booleanFlag")}},
                {field: 'javaType', title: 'JAVA类型', align: 'center', width: 100},
                {field: 'javaFullType', title: 'JAVA类型(全)', align: 'center', width: 100, hidden: true},
                {field: 'javaVoType', title: 'JAVA扩展类型', align: 'center', width: 100, hidden: true},
                {field: 'orderNum', title: '排序', align: 'center', width: 100},
                {field: 'dataStatus', title: '状态', align: 'center', width: 100, formatter: function(value,rowData,rowIndex){return zUtil.dictConvertOfAutocode(value,"dict.dataStatus")}},
                {field: 'createName', title: '创建用户', align: 'center', width: 100},
                {field: 'createTm', title: '创建时间', align: 'center', width: 135,sortable: true},
                {field: ' ', title: ' ', align: 'center', width: 100},
            ]],
            frozenColumns:[[
//              {field:'', title:'', align:'center', checkbox:true},
             {field:'buttonArr', title:'操作', align:'center', width: 60, formatter:buttonsFormatterRight},
             {field: 'matchingRule', title: '匹配规则', align: 'center', width: 100},
            ]],
            onDblClickCell: function(rowIndex, field, value){
                if("buttonArr" != field){
                    dlgDtlRight(rowIndex);
                }
            },
            onSelect: function(rowIndex, rowData){
            },
            onHeaderContextMenu: function(e, field){
              TableHeaderRightMenu = zUtil.tableHeaderMenu(e,TableHeaderRightMenu,IdTableRight);
            },
            onRowContextMenu: function(e, rowIndex, rowData){
              e.preventDefault();
              zUtil.tableSelected(IdTableRight,rowIndex);
              if(rowData != null){
                  dlgEditRight(rowData);
              }
            },
    };
    zUtil.tableInit(IdTableRight,optionsRight,buttonsIdxRight,buttonsFuncRight);
        
        
    /* --分割------------------------------------------------------------------------------ */
    
  });
  
  function loadDictToPage(){
      var returnHandler = function(dict){
          zDictAutocode = dict;
          DictNames['dict.databaseType'] = 'databaseType';
          DictNames['fieldMapping.matchWay'] = 'matchWay';
          DictNames['dict.dataStatus'] = 'dataStatus';
          DictNames['dict.booleanFlag'] = 'standardFlag';
          DictNames['ZSELECT_FIELD_MAPPING'] = 'mappingId';
          
          var linkSelsetIds = [IdDlgQueryLeft,IdDlgAddLeft,IdDlgEditLeft,IdDlgQueryRight,IdDlgAddRight,IdDlgEditRight];
          $.each(linkSelsetIds,function(i,item){
              zUtil.selectFill(item,DictNames,zDictAutocode);
              
              zUtil.inputInit(item +" #jdbcType",'input',{
                  icons:[{
                      iconCls:'icon-add',
                      text:'快捷选择',
                      handler: function(e){
                          dlgSelectJdbcTypeMappingRules(item);
                      }
                  }]
              });
          });
      };
      zUtil.dictLoadOfAutocode("dict.databaseType,fieldMapping.matchWay,dict.dataStatus,dict.booleanFlag"
              +",ZSELECT_FIELD_MAPPING"
          ,null,returnHandler);
  }
  
  /* --分割------------------------------------------------------------------------------ */
  
  //TODO
  function buttonsFormatterLeft(value,rowData,rowIndex){
    return '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgDelLeft('+rowIndex+');" title="删除" ><i class="fa fa-trash"> </i></a> ';
  }
  //TODO
  function dlgQueryLeft(){
    var dlgSave = function(){
      var params = zUtil.valAll(IdDlgQueryLeft);
      zUtil.tableQuery(IdTableLeft,params);
      zUtil.tableData(IdTableRight,[]);
      zUtil.tableUnSelected(IdTableLeft);
      TableSelectFlag = null;
    };
    var dlgClear = function(){
      zUtil.formClear(IdDlgQueryLeft + ' form');
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgQueryLeft);
    };
    var dlgOptions = {
      title: TitleLeft + '-查询',
    };
    var dlgButtonsIdx = [0,1,2];
    var dlgButtonsFunc =  [dlgSave,dlgClear,dlgClose];
    zUtil.queryInit(IdDlgQueryLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgQueryLeft);
  };
  //TODO
  function dlgQueryxLeft(){
    //zUtil.dialogOpen(IdDlgQueryxLeft);
  };
  //TODO
  function dlgAddLeft(){
    zUtil.formClear(IdDlgAddLeft + ' form');
    zUtil.readonlyAll(IdDlgAddLeft,false);
    
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgAddLeft +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgAddLeft);
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMapping/add", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryLeft);
          zUtil.tableQuery(IdTableLeft,params);
          zUtil.dialogClose(IdDlgAddLeft);
        }else{
          zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgAddLeft);
    };
    var dlgOptions = {
       title: TitleLeft + '-新增',
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgAddLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);   
    zUtil.dialogOpen(IdDlgAddLeft);
  };
  //TODO  
  function dlgEditLeft(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }
    
    zUtil.formClear(IdDlgEditLeft + ' form');
    zUtil.readonlyAll(IdDlgEditLeft,false);
    zUtil.readonly(IdDlgEditLeft + ' #mappingId');
    zUtil.readonly(IdDlgEditLeft + ' #dataStatus');
    zUtil.readonly(IdDlgEditLeft + ' #createOprid');
    zUtil.readonly(IdDlgEditLeft + ' #createName');
    zUtil.readonly(IdDlgEditLeft + ' #createTm');
    zUtil.readonly(IdDlgEditLeft + ' #lastUpdOprid');
    zUtil.readonly(IdDlgEditLeft + ' #lastUpdName');
    zUtil.readonly(IdDlgEditLeft + ' #lastUpdTm');
     
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgEditLeft +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgEditLeft);
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMapping/edit", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryLeft);
          zUtil.tableQuery(IdTableLeft,params);
          zUtil.dialogClose(IdDlgEditLeft);
        }else{
          zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditLeft);
    };
    var dlgOptions = {
      title: TitleLeft + '-编辑',
      onOpen : function(){
        var params = {};
        params['mappingId']  = row['mappingId'];
        zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMapping/detail", {reqData:params}
        ,function(result){
            if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取信息失败');
              return false;
            }
            zUtil.valAll(IdDlgEditLeft,result[zConst["resData"]]);
        });
      }
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgEditLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgEditLeft);
  };
  //TODO
  function dlgDtlLeft(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }
    zUtil.formClear(IdDlgEditLeft + ' form');
    zUtil.readonlyAll(IdDlgEditLeft);
          
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditLeft);
    };
    var dlgOptions = {
      title: TitleLeft + '-详情',
      onOpen : function(){
        var params = {};
        params['mappingId']  = row['mappingId'];
        zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMapping/detail", {reqData:params}
        ,function(result){
            if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取信息失败');
              return false;
            }
            zUtil.valAll(IdDlgEditLeft,detail[result["resData"]]);
        });
      }
    };
    var dlgButtonsIdx = [1];
    var dlgButtonsFunc =  [dlgClose];
    zUtil.dialogInit(IdDlgEditLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgEditLeft);
  };
  //TODO
  function dlgDelLeft(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }
    
    var params = {}; 
    params['mappingId']  = row['mappingId'];
    var reqData = {reqData: params};
    var okfunc = function(){
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMapping/del", reqData
      ,function(result){
          if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
            var params = zUtil.valAll(IdDlgQueryLeft);
            zUtil.tableQuery(IdTableLeft,params);
            zUtil.tableData(IdTableRight,[]);
          }else{
            zUtil.msg('操作失败'+(result.busMsg?'. '+result.busMsg:''));
          }
      });
    }
    zUtil.msgConfirm("确认删除已选中记录?",okfunc);
  };

  /* --分割------------------------------------------------------------------------------ */
  //TODO
  function getTableLeft(){
      var rowLeft =  zUtil.tableRows(IdTableLeft);
      if(rowLeft == null || rowLeft.length == 0){
          zUtil.msg('未选择左侧数据');
          return null;
      }
      return rowLeft;
  }
  //TODO
  function buttonsFormatterRight(value,rowData,rowIndex){
    return '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgDelRight('+rowIndex+');" title="删除" ><i class="fa fa-trash"> </i></a> '
  }
  //TODO
  function dlgQueryRight(){
    var rowLeft = getTableLeft();
    if(rowLeft == null){
      return false;
    };

    zUtil.readonly(IdDlgQueryRight + ' #mappingId');

    var dlgSave = function(){
      var params = zUtil.valAll(IdDlgQueryRight);
      zUtil.tableQuery(IdTableRight,params);
    };
    var dlgClear = function(){
      zUtil.formClear(IdDlgQueryRight + ' form');
      zUtil.val(IdDlgQueryRight + ' #mappingId',rowLeft['mappingId']);
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgQueryRight);
    };
    var dlgOptions = {
      title: TitleRight + '-查询',
    };
    var dlgButtonsIdx = [0,1,2];
    var dlgButtonsFunc =  [dlgSave,dlgClear,dlgClose];
    zUtil.queryInit(IdDlgQueryRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgQueryRight);
  };
  //TODO
  function dlgQueryxRight(){
    //zUtil.dialogOpen(IdDlgQueryxRight);
  };
  //TODO
  function dlgAddRight(){
    var rowLeft = getTableLeft();
    if(rowLeft == null){
      return false;
    };
    
    zUtil.formClear(IdDlgAddRight + ' form');
    zUtil.readonlyAll(IdDlgAddRight,false);
    zUtil.val(IdDlgAddRight + ' #mappingId',rowLeft['mappingId'])
    zUtil.readonly(IdDlgAddRight + ' #mappingId');
    
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgAddRight +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgAddRight);
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMappingDtl/add", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryRight);
          zUtil.tableQuery(IdTableRight,params);
          zUtil.dialogClose(IdDlgAddRight);
        }else{
          zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
      
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgAddRight);
    };
    var dlgOptions = {
       title: TitleRight + '-新增',
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgAddRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);   
    zUtil.dialogOpen(IdDlgAddRight);
  };
  //TODO  
  function dlgEditRight(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableRight,row);
      row = zUtil.tableRows(IdTableRight);
    }
    zUtil.formClear(IdDlgEditRight + ' form');
    zUtil.readonlyAll(IdDlgEditRight,false);
    zUtil.readonly(IdDlgEditRight + ' #mappingDtlId');
    zUtil.readonly(IdDlgEditRight + ' #mappingId');
    zUtil.readonly(IdDlgEditRight + ' #dataStatus');
    zUtil.readonly(IdDlgEditRight + ' #createOprid');
    zUtil.readonly(IdDlgEditRight + ' #createName');
    zUtil.readonly(IdDlgEditRight + ' #createTm');
    zUtil.readonly(IdDlgEditRight + ' #lastUpdOprid');
    zUtil.readonly(IdDlgEditRight + ' #lastUpdName');
    zUtil.readonly(IdDlgEditRight + ' #lastUpdTm');
    
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgEditRight +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgEditRight);
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMappingDtl/edit", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryRight);
          zUtil.tableQuery(IdTableRight,params);
          zUtil.dialogClose(IdDlgEditRight);
        }else{
          zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
      
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditRight);
    };
    var dlgOptions = {
      title: TitleRight + '-编辑',
      onOpen : function(){
        var params = {};
        params['mappingDtlId']  = row['mappingDtlId'];
        zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMappingDtl/detail", {reqData:params}
        ,function(result){
            if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取信息失败');
              return false;
            }
            zUtil.valAll(IdDlgEditRight,result[zConst["resData"]]);
        });
      }
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgEditRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgEditRight);
  };
  //TODO
  function dlgDtlRight(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableRight,row);
      row = zUtil.tableRows(IdTableRight);
    }
    zUtil.formClear(IdDlgEditRight + ' form');
    zUtil.readonlyAll(IdDlgEditRight);
          
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditRight);
    };
    var dlgOptions = {
      title: TitleRight + '-详情',
      onOpen : function(){
        var params = {};
        params['mappingDtlId']  = row['mappingDtlId'];
        zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMappingDtl/detail", {reqData:params}
        ,function(result){
            if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取信息失败');
              return false;
            }
            zUtil.valAll(IdDlgEditRight,result[zConst["resData"]]);
        });
      }
    };
    var dlgButtonsIdx = [1];
    var dlgButtonsFunc =  [dlgClose];
    zUtil.dialogInit(IdDlgEditRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgEditRight);
  };
  //TODO
  function dlgDelRight(row){
    if($.isNumeric(row)){
        zUtil.tableSelected(IdTableRight,row);
        row = zUtil.tableRows(IdTableRight);
    }
    
    var params = {}; 
    params['mappingDtlId']  = row['mappingDtlId'];
    var reqData = {reqData: params};
    var okfunc = function(){
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/fieldMappingDtl/del", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryRight);
          zUtil.tableQuery(IdTableRight,params);
        }else{
          zUtil.msg('操作失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
    }
    zUtil.msgConfirm("确认删除已选中记录?",okfunc);
  };
   
function dlgSelectJdbcTypeMappingRules(el){
    zUtil.dialogInit('#dlg-select-jdbcType'
              , {
                  title: "映射规则",
                  width: 650,
                  height: 450,
                  draggable: true,
                  onOpen:function(){
                      zUtil.tableInit2('#table-jdbcType',{
                          sortName: 'orderNum',
                          sortOrder: 'desc',
                          toolbar:'#table-jdbcType-toolbar',
                          url: zGlobal["http"] + "/autocode/dictDtl/list",
                          queryParams:{dictType: 'fieldMapping.fieldTypeList'},
                          columns:[[
                              {field: 'dictType', title: '类型编码', align: 'center', width: 100,hidden:true},
                              {field: 'dictDisplay2', title: '转换关系', align: 'left',halign: 'center', width: 300},
//                               {field: 'dataStatus', title: '状态', align: 'center', width: 50, formatter: function(value,rowData,rowIndex){return zUtil.dictConvertOfAutocode(value,"dict.dataStatus")}},
                              {field: ' ', title: ' ', align: 'center', width: 50},
                          ]],
                          frozenColumns:[[
                           {field: 'dictDtlNo', title: '明细编号', align: 'center', width: 80},
                           {field: 'dictDisplay1', title: 'jdbc转java', align: 'left',halign: 'center', width: 170},
                          ]],
                          onSelect: function(index, row){
                              if(row && row['dictDisplay2']){
                                  var arr = row['dictDisplay2'].split("-");
                                  zUtil.val(el + ' #jdbcType',arr[0]);
                                  zUtil.val(el + ' #javaType',arr[1]);
                                  zUtil.val(el + ' #javaFullType',arr[2]);
                                  zUtil.val(el + ' #javaVoType',arr[3]);
                                  zUtil.val(el + ' #standardFlag',arr[4]);
                              }
                          },
                    });
                  }
                }
              , [1]
              , [function(){
                    zUtil.dialogClose('#dlg-select-jdbcType');
                }]
                ,true
     );
}
</script>

</body>
</html>